#include<bits/stdc++.h>
using namespace std;
const int MAXN=50;
int n;
struct Num
{
	int len,num[MAXN];
	Num()
	{
		memset(num,0,sizeof(num));
		len=0;
	}
	int& operator[] (int x)
	{
		return num[x];
	}
	Num operator* (int x)const
	{
		Num ret;
		int i;
		for(i=1;i<=len;++i)
		{
			ret[i]+=num[i]*x;
			ret[i+1]=ret[i]/10;
			ret[i]%=10;
		}
		if(!ret[i])--i;
		while(ret.num[i]>9)
		{
			ret[i+1]=ret[i]/10;
			ret[i++]%=10;
		}
		ret.len=i;
		return ret;
	}
	Num operator- (Num x)const
	{
		Num ret;
		int i;
		for(i=1;i<=len;++i)
		{
			ret[i]+=num[i]-x[i];
			if(ret[i]<0)
			{
				--ret[i+1];
				ret[i]+=10;
			}
		}
		while(!ret[i])--i;
		ret.len=i;
		return ret;
	}
	void copy(Num a)
	{
		memcpy(num,a.num,sizeof(a.num));
		len=a.len;
	}
};
int main()
{
	scanf("%d",&n);
	if(n==1)
	{
		printf("1\n");
		return 0;
	}
	if(n==2)
	{
		printf("5\n");
		return 0;
	}
	Num a,b,c;
	a.len=1;a[1]=1;
	b.len=1;b[1]=5;
	for(int i=3;i<=n;++i)
	{
		c=b*3;
		c=c-a;
		c[1]+=2;
		int j=1;
		while(c[j]>=10)
		{
			c[j+1]+=c[j]/10;
			c[j]%=10;
			++j;
		}
		a.copy(b);
		b.copy(c);
	}
	for(int i=b.len;i>=1;--i)printf("%d",b[i]);
	printf("\n");
	return 0;
}
